//========================================================================
/**
 * Author   : cuisw <shaovie@gmail.com>
 * Date     : 2008-01-06 15:07
 */
//========================================================================

#ifndef _RWTHREADMUTEX_H_
#define _RWTHREADMUTEX_H_
#include "Pre.h"

#if defined NDK_LINUX
#   include <pthread.h>
#elif defined NDK_WIN32
#endif

/**
 * @class RWThreadMutex
 *
 * @brief 
 */
class RWThreadMutex
{
public:
    RWThreadMutex ();

    ~RWThreadMutex ();

    //
    int acquire_read (void);

    //
    int acquire_write (void);

    //
    int tryacquire_read (void);

    //
    int tryacquire_write (void);

    // Unlock a readers/writer lock.
    int release (void);
private:
    pthread_rwlock_t rwlock_;
};

#include "RWThreadMutex.inl"
#include "Post.h"
#endif

